﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using DataLib.DBUtility;
using log4net;

namespace DataLib.DAL
{
	/// <summary>
	/// 数据访问类:Cjo
	/// </summary>
	public partial class Cjo
	{
		public Cjo()
		{}
        #region  BasicMethod

        /// <summary>
        /// 得到最大ID
        /// </summary>
        public int GetMaxId()
        {
            return DbHelperSQL.GetMaxID("id", "Cjo");
        }

        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int? id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from Cjo");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            return DbHelperSQL.Exists(strSql.ToString(), parameters);
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DataLib.Model.Cjo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("insert into Cjo(");
            strSql.Append("loadnumid,cjono,status,createtime,islocal,loadnum,customerid,customercode,customername,operman,predictweight,cjocolldate,addid,goodsdesc,graphiccity,belogcity,rubbType,cjoadd,cjophone,cjolinkman,sealman_show,sealman_create,sealman_auth,sealman_view,istyz,bussinesstype,cjoremark)");
            strSql.Append(" values (");
            strSql.Append("@loadnumid,@cjono,@status,@createtime,@islocal,@loadnum,@customerid,@customercode,@customername,@operman,@predictweight,@cjocolldate,@addid,@goodsdesc,@graphiccity,@belogcity,@rubbType,@cjoadd,@cjophone,@cjolinkman,@sealman_show,@sealman_create,@sealman_auth,@sealman_view,@istyz,@bussinesstype,@cjoremark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters = {
					new SqlParameter("@loadnumid", SqlDbType.Int,4),
					new SqlParameter("@cjono", SqlDbType.NVarChar,30),
					new SqlParameter("@status", SqlDbType.Int,4),
					new SqlParameter("@createtime", SqlDbType.DateTime),
					new SqlParameter("@islocal", SqlDbType.Bit,1),
					new SqlParameter("@loadnum", SqlDbType.NVarChar,30),
					new SqlParameter("@customerid", SqlDbType.NVarChar,30),
					new SqlParameter("@customercode", SqlDbType.NVarChar,30),
					new SqlParameter("@customername", SqlDbType.NVarChar,50),
					new SqlParameter("@operman", SqlDbType.NVarChar,30),
					new SqlParameter("@predictweight", SqlDbType.Decimal,9),
					new SqlParameter("@cjocolldate", SqlDbType.DateTime),
					new SqlParameter("@addid", SqlDbType.Int,4),
					new SqlParameter("@goodsdesc", SqlDbType.NVarChar,50),
					new SqlParameter("@graphiccity", SqlDbType.NVarChar,20),
					new SqlParameter("@belogcity", SqlDbType.NVarChar,20),
					new SqlParameter("@rubbType", SqlDbType.NVarChar,200),
					new SqlParameter("@cjoadd", SqlDbType.NVarChar,500),
					new SqlParameter("@cjophone", SqlDbType.NVarChar,50),
					new SqlParameter("@cjolinkman", SqlDbType.NVarChar,20),
					new SqlParameter("@sealman_show", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_create", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_auth", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_view", SqlDbType.VarChar,200),
                    new SqlParameter("@istyz", SqlDbType.VarChar,20),
                    new SqlParameter("@bussinesstype", SqlDbType.VarChar,20),
                    new SqlParameter("@cjoremark", SqlDbType.VarChar,200),
                                        };
            parameters[0].Value = model.loadnumid;
            parameters[1].Value = model.cjono;
            parameters[2].Value = model.status;
            parameters[3].Value = model.createtime;
            parameters[4].Value = model.islocal;
            parameters[5].Value = model.loadnum;
            parameters[6].Value = model.customerid;
            parameters[7].Value = model.customercode;
            parameters[8].Value = model.customername;
            parameters[9].Value = model.operman;
            parameters[10].Value = model.predictweight;
            parameters[11].Value = model.cjocolldate;
            parameters[12].Value = model.addid;
            parameters[13].Value = model.goodsdesc;
            parameters[14].Value = model.graphiccity;
            parameters[15].Value = model.belogcity;
            parameters[16].Value = model.rubbType;
            parameters[17].Value = model.cjoadd;
            parameters[18].Value = model.cjophone;
            parameters[19].Value = model.cjolinkman;
            parameters[20].Value = model.sealman_show;
            parameters[21].Value = model.sealman_create;
            parameters[22].Value = model.sealman_auth;
            parameters[23].Value = model.sealman_view;
            parameters[24].Value = model.istyz;
            parameters[25].Value = model.bussinesstype;
            parameters[26].Value = model.cjoremark;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DataLib.Model.Cjo model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update Cjo set ");
            strSql.Append("loadnumid=@loadnumid,");
            strSql.Append("cjono=@cjono,");
            strSql.Append("status=@status,");
            strSql.Append("createtime=@createtime,");
            strSql.Append("islocal=@islocal,");
            strSql.Append("loadnum=@loadnum,");
            strSql.Append("customerid=@customerid,");
            strSql.Append("customercode=@customercode,");
            strSql.Append("customername=@customername,");
            strSql.Append("operman=@operman,");
            strSql.Append("predictweight=@predictweight,");
            strSql.Append("cjocolldate=@cjocolldate,");
            strSql.Append("addid=@addid,");
            strSql.Append("goodsdesc=@goodsdesc,");
            strSql.Append("graphiccity=@graphiccity,");
            strSql.Append("belogcity=@belogcity,");
            strSql.Append("rubbType=@rubbType,");
            strSql.Append("cjoadd=@cjoadd,");
            strSql.Append("cjophone=@cjophone,");
            strSql.Append("cjolinkman=@cjolinkman,");
            strSql.Append("sealman_show=@sealman_show,");
            strSql.Append("sealman_create=@sealman_create,");
            strSql.Append("sealman_auth=@sealman_auth,");
            strSql.Append("sealman_view=@sealman_view,");
            strSql.Append("istyz=@istyz,");
            strSql.Append("bussinesstype=@bussinesstype,");
            strSql.Append("cjoremark=@cjoremark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@loadnumid", SqlDbType.Int,4),
					new SqlParameter("@cjono", SqlDbType.NVarChar,30),
					new SqlParameter("@status", SqlDbType.Int,4),
					new SqlParameter("@createtime", SqlDbType.DateTime),
					new SqlParameter("@islocal", SqlDbType.Bit,1),
					new SqlParameter("@loadnum", SqlDbType.NVarChar,30),
					new SqlParameter("@customerid", SqlDbType.NVarChar,30),
					new SqlParameter("@customercode", SqlDbType.NVarChar,30),
					new SqlParameter("@customername", SqlDbType.NVarChar,50),
					new SqlParameter("@operman", SqlDbType.NVarChar,30),
					new SqlParameter("@predictweight", SqlDbType.Decimal,9),
					new SqlParameter("@cjocolldate", SqlDbType.DateTime),
					new SqlParameter("@addid", SqlDbType.Int,4),
					new SqlParameter("@goodsdesc", SqlDbType.NVarChar,50),
					new SqlParameter("@graphiccity", SqlDbType.NVarChar,20),
					new SqlParameter("@belogcity", SqlDbType.NVarChar,20),
					new SqlParameter("@rubbType", SqlDbType.NVarChar,200),
					new SqlParameter("@cjoadd", SqlDbType.NVarChar,500),
					new SqlParameter("@cjophone", SqlDbType.NVarChar,50),
					new SqlParameter("@cjolinkman", SqlDbType.NVarChar,20),
					new SqlParameter("@sealman_show", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_create", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_auth", SqlDbType.VarChar,20),
					new SqlParameter("@sealman_view", SqlDbType.VarChar,200),
					new SqlParameter("@id", SqlDbType.Int,4),
                    new SqlParameter("@istyz", SqlDbType.VarChar,20),
                    new SqlParameter("@bussinesstype", SqlDbType.VarChar,20),
                    new SqlParameter("@cjoremark", SqlDbType.VarChar,200)
            };
            parameters[0].Value = model.loadnumid;
            parameters[1].Value = model.cjono;
            parameters[2].Value = model.status;
            parameters[3].Value = model.createtime;
            parameters[4].Value = model.islocal;
            parameters[5].Value = model.loadnum;
            parameters[6].Value = model.customerid;
            parameters[7].Value = model.customercode;
            parameters[8].Value = model.customername;
            parameters[9].Value = model.operman;
            parameters[10].Value = model.predictweight;
            parameters[11].Value = model.cjocolldate;
            parameters[12].Value = model.addid;
            parameters[13].Value = model.goodsdesc;
            parameters[14].Value = model.graphiccity;
            parameters[15].Value = model.belogcity;
            parameters[16].Value = model.rubbType;
            parameters[17].Value = model.cjoadd;
            parameters[18].Value = model.cjophone;
            parameters[19].Value = model.cjolinkman;
            parameters[20].Value = model.sealman_show;
            parameters[21].Value = model.sealman_create;
            parameters[22].Value = model.sealman_auth;
            parameters[23].Value = model.sealman_view;
            parameters[24].Value = model.id;
            parameters[25].Value = model.istyz;
            parameters[26].Value = model.bussinesstype;
            parameters[27].Value = model.cjoremark;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                LTR_CJO d = new LTR_CJO();
                Model.LTR_CJO m = new Model.LTR_CJO();
                m = d.GetModelByCjoID((int)model.id);
                if (m != null)
                { 
                    switch(model.status)
                    {
                        case 1:
                            m.cjostatus = "派车中";
                            break;
                        case 2:
                            m.cjostatus = "待称重";
                            break;
                        case 3:
                            m.cjostatus = "待处理";
                            break;
                        case 4:
                            m.cjostatus = "待处理";
                            break;
                        case 5:
                            m.cjostatus = "处理完";
                            break;                       
                        case -9:
                            m.cjostatus = "作废";
                            break;                        
                        case -1:
                            m.cjostatus = "退运";
                            break;                        
                        case -2:
                            m.cjostatus = "直销";
                            break;                        
                        default:
                            break;
                    }

                    d.Update(m);
                }
                return true;
            }
            else
            {
                return false;
            }
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public bool Delete(int? id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Cjo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 批量删除数据
        /// </summary>
        public bool DeleteList(string idlist)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from Cjo ");
            strSql.Append(" where id in (" + idlist + ")  ");
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString());
            if (rows > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DataLib.Model.Cjo GetModel(int? id)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,loadnumid,cjono,status,createtime,islocal,loadnum,customerid,customercode,customername,operman,predictweight,cjocolldate,addid,goodsdesc,graphiccity,belogcity,rubbType,cjoadd,cjophone,cjolinkman,sealman_show,sealman_create,sealman_auth,sealman_view,istyz,bussinesstype,cjoremark from Cjo ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters = {
					new SqlParameter("@id", SqlDbType.Int,4)
			};
            parameters[0].Value = id;

            DataLib.Model.Cjo model = new DataLib.Model.Cjo();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }


        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DataLib.Model.Cjo DataRowToModel(DataRow row)
        {
            DataLib.Model.Cjo model = new DataLib.Model.Cjo();
            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["loadnumid"] != null && row["loadnumid"].ToString() != "")
                {
                    model.loadnumid = int.Parse(row["loadnumid"].ToString());
                }
                if (row["cjono"] != null)
                {
                    model.cjono = row["cjono"].ToString();
                }
                if (row["status"] != null && row["status"].ToString() != "")
                {
                    model.status = int.Parse(row["status"].ToString());
                }
                if (row["createtime"] != null && row["createtime"].ToString() != "")
                {
                    model.createtime = DateTime.Parse(row["createtime"].ToString());
                }
                if (row["islocal"] != null && row["islocal"].ToString() != "")
                {
                    if ((row["islocal"].ToString() == "1") || (row["islocal"].ToString().ToLower() == "true"))
                    {
                        model.islocal = true;
                    }
                    else
                    {
                        model.islocal = false;
                    }
                }
                if (row["loadnum"] != null)
                {
                    model.loadnum = row["loadnum"].ToString();
                }
                if (row["customerid"] != null)
                {
                    model.customerid = row["customerid"].ToString();
                }
                if (row["customercode"] != null)
                {
                    model.customercode = row["customercode"].ToString();
                }
                if (row["customername"] != null)
                {
                    model.customername = row["customername"].ToString();
                }
                if (row["operman"] != null)
                {
                    model.operman = row["operman"].ToString();
                }
                if (row["predictweight"] != null && row["predictweight"].ToString() != "")
                {
                    model.predictweight = decimal.Parse(row["predictweight"].ToString());
                }
                if (row["cjocolldate"] != null && row["cjocolldate"].ToString() != "")
                {
                    model.cjocolldate = DateTime.Parse(row["cjocolldate"].ToString());
                }
                if (row["addid"] != null && row["addid"].ToString() != "")
                {
                    model.addid = int.Parse(row["addid"].ToString());
                }
                if (row["goodsdesc"] != null)
                {
                    model.goodsdesc = row["goodsdesc"].ToString();
                }
                if (row["graphiccity"] != null)
                {
                    model.graphiccity = row["graphiccity"].ToString();
                }
                if (row["belogcity"] != null)
                {
                    model.belogcity = row["belogcity"].ToString();
                }
                if (row["rubbType"] != null)
                {
                    model.rubbType = row["rubbType"].ToString();
                }
                if (row["cjoadd"] != null)
                {
                    model.cjoadd = row["cjoadd"].ToString();
                }
                if (row["cjophone"] != null)
                {
                    model.cjophone = row["cjophone"].ToString();
                }
                if (row["cjolinkman"] != null)
                {
                    model.cjolinkman = row["cjolinkman"].ToString();
                }
                if (row["sealman_show"] != null)
                {
                    model.sealman_show = row["sealman_show"].ToString();
                }
                if (row["sealman_create"] != null)
                {
                    model.sealman_create = row["sealman_create"].ToString();
                }
                if (row["sealman_auth"] != null)
                {
                    model.sealman_auth = row["sealman_auth"].ToString();
                }
                if (row["sealman_view"] != null)
                {
                    model.sealman_view = row["sealman_view"].ToString();
                }
                if (row["istyz"] != null)
                {
                    model.istyz = row["istyz"].ToString();
                }
                if (row["bussinesstype"] != null)
                {
                    model.bussinesstype = row["bussinesstype"].ToString();
                }
                if (row["cjoremark"] != null)
                {
                    model.cjoremark = row["cjoremark"].ToString();
                }
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select id,loadnumid,cjono,status,createtime,islocal,loadnum,customerid,customercode,customername,operman,predictweight,cjocolldate,addid,goodsdesc,graphiccity,belogcity,rubbType,cjoadd,cjophone,cjolinkman,sealman_show,sealman_create,sealman_auth,sealman_view,istyz,bussinesstype,cjoremark ");
            strSql.Append(" FROM Cjo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select ");
            if (Top > 0)
            {
                strSql.Append(" top " + Top.ToString());
            }
            strSql.Append(" id,loadnumid,cjono,status,createtime,islocal,loadnum,customerid,customercode,customername,operman,predictweight,cjocolldate,addid,goodsdesc,graphiccity,belogcity,rubbType,cjoadd,cjophone,cjolinkman,sealman_show,sealman_create,sealman_auth,sealman_view,istyz,bussinesstype,cjoremark ");
            strSql.Append(" FROM Cjo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            strSql.Append(" order by " + filedOrder);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /// <summary>
        /// 获取记录总数
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) FROM Cjo ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            object obj = DbHelperSQL.GetSingle(strSql.ToString());
            if (obj == null)
            {
                return 0;
            }
            else
            {
                return Convert.ToInt32(obj);
            }
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("SELECT * FROM ( ");
            strSql.Append(" SELECT ROW_NUMBER() OVER (");
            if (!string.IsNullOrEmpty(orderby.Trim()))
            {
                strSql.Append("order by T." + orderby);
            }
            else
            {
                strSql.Append("order by T.id desc");
            }
            strSql.Append(")AS Row, T.*  from Cjo T ");
            if (!string.IsNullOrEmpty(strWhere.Trim()))
            {
                strSql.Append(" WHERE " + strWhere);
            }
            strSql.Append(" ) TT");
            strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);
            return DbHelperSQL.Query(strSql.ToString());
        }

        /*
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@PageSize", SqlDbType.Int),
                    new SqlParameter("@PageIndex", SqlDbType.Int),
                    new SqlParameter("@IsReCount", SqlDbType.Bit),
                    new SqlParameter("@OrderType", SqlDbType.Bit),
                    new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
                    };
            parameters[0].Value = "Cjo";
            parameters[1].Value = "id";
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 0;
            parameters[6].Value = strWhere;	
            return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
        }*/

        #endregion  BasicMethod

		#region  ExtensionMethod

        /// <summary>
        /// 获取Load下面的CJO列表
        /// </summary>
        /// <param name="loadid">Load的ID</param>
        /// <returns></returns>
        public DataTable GetCJOList(string loadid)
        {
            DataTable dt = new DataTable();
            string strsql = @"SELECT CJO.[id]
      ,[loadnumid]
      ,[cjono]
      ,[createtime]
      ,[customercode]
      ,[customername]
      ,loadnum.belongarea
    ,LoadNum.loadnum
    ,LoadNum.Status
    ,Cjo.isLocal
  From [Cjo],LoadNum
  where Cjo.loadnumid = loadnum.id and Cjo.loadnumid=" + loadid;
            dt = DbHelperSQL.Query(strsql).Tables[0];
            return dt;
        }

        public int MaxCjonoByLoad(string loadno)
        {
            int maxcjono = 0;
            DataTable dt = new DataTable();
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select top 1 RIGHT(cjono,3) ");
            strSql.Append("FROM Cjo ");
            strSql.Append("where left(cjono,9)='");
            strSql.Append(loadno);
            strSql.Append("' order by SUBSTRING(cjono,11,3) desc");

            dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];

            if (dt != null && dt.Rows.Count == 1 && dt.Rows[0][0] != null && dt.Rows[0][0].ToString() != "")
                maxcjono = int.Parse(dt.Rows[0][0].ToString()) + 1;
            else
                maxcjono = 1;

            return maxcjono;
        }

        /// <summary>
        /// 根据处理地取得所有cjo列表
        /// </summary>
        /// <param name="city"></param>
        /// <returns></returns>
        public DataTable GetLoadnumList(string city) 
        {
            StringBuilder strSql = new StringBuilder();
            DataTable dt = new DataTable();
            strSql.Append("select c.id cjoid,c.loadnumid loadnumid,cjono,c.status,c.createtime,islocal,c.loadnum,c.customerid,customercode,customername,operman,predictweight,");
            strSql.Append("cjocolldate,addid,goodsdesc,graphiccity,belogcity,rubbType,cjoadd,cjophone,cjolinkman,sealman_show,sealman_create,sealman_auth,sealman_view,istyz,bussinesstype");
            strSql.Append(",vr.id,workercount,vehiclecount,othercost,other,tools,clearingform,numberestimate,maternrequire,samplingrequire,peculiarrequire,otherrequire,othervrequire,pr.addressid");
            strSql.Append(",Rubbisharea,belongarea,collectdate,goodsInfo,totalWeight,finishWeight,saleman,RubbishType,CurFlow,Memo,createdate,l.projectid,l.projectcode,l.projectname,status_tally");
            strSql.Append(",finishtallyweight,cjoname,printname,labname,vehicleNo,platenumberid,vehiderid,sealno,Platecate,platenumber,vehider,pr.AddresssName,c.cjoremark ");
            strSql.Append(" FROM Cjo c inner join VehicleRequire vr on vr.cjoid=c.id");
            strSql.Append(" inner join ProjectsRelation pr on c.addid=pr.ID");
            strSql.Append(" inner join LoadNum l on c.loadnumid=l.id");
            strSql.Append(" left join InStorage ins on c.id=ins.cjoid and LEFT(ins.wrlno,1)='M'");
            strSql.Append("left join VehicleArrange va on c.id=va.cjoid ");
            if (city != null && city.Trim() != "")
            {
                strSql.Append(" Where c.graphiccity='" + city + "'");
            }
            dt = DbHelperSQL.Query(strSql.ToString()).Tables[0];
            return dt;
        }
		#endregion  ExtensionMethod
	}
}

